package com.smh.a02ClassLoadDemo;

import java.io.IOException;
import java.io.InputStream;

public class Test {
    public static void main(String[] args) throws IOException {

        //获得系统类加载器
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();

        // 获得系统类加载器的父加载器 ---平台类加载器
        ClassLoader parent = systemClassLoader.getParent();

        //获得启动类加载器
        ClassLoader parent1 = parent.getParent();

        System.out.println(systemClassLoader);
        System.out.println(parent);
        System.out.println(parent1);

        InputStream resourceAsStream = systemClassLoader.getResourceAsStream("prop.properties");
        byte[] bytes = new byte[1024];
        int len;
        while ((len = resourceAsStream.read(bytes)) != -1) {
            System.out.print(new String(bytes, 0, len));
        }

    }
}
